package com.twu.biblioteca.menu;

import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintStream;
import java.io.PrintWriter;

/**
 * Created with IntelliJ IDEA.
 * User: cschlumb
 * Date: 05/08/2013
 * Time: 16:59
 * To change this template use File | Settings | File Templates.
 */
public class MenuFormatter{

    private final StringBuilder sb;
    private final PrintStream printStream;

    public MenuFormatter(PrintStream printStream) {
        this.printStream = printStream;

        sb = new StringBuilder();
        sb.append("Please select from the following options: \n");
    }

    public void addMenuItem(int ordinal, String name) {
        sb.append(ordinal);
        sb.append(") ");
        sb.append(name);
        sb.append('\n');
    }

    public void print() {
        printStream.println(sb.toString());
    }
}
